package com.ljx.reflect.reflect01;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author LJX
 * @Description: TODO
 * @Date: 2022/10/25 20:56
 * @Version 1.0
 */
public class Test {
	public static void main(String[] args) throws ClassNotFoundException {
		// 通过全类名获取Class的反射对象
		Class aClass = Class.forName("com.ljx.reflect.reflect01.Student");
		System.out.println("aClass = " + aClass);
		// 通过类名获取
		Class studentClass = Student.class;
		System.out.println(studentClass);
		// 通过对象名获取
		Student student = new Student();
		Class aClass1 = student.getClass();
		System.out.println(aClass1==studentClass);
		Class fatherClass = Father.class;
		System.out.println(aClass==fatherClass);
	}
}


@Data
@NoArgsConstructor
@AllArgsConstructor
class Student{
	private String name;
	private Integer age;

}
@Data
@NoArgsConstructor
@AllArgsConstructor
class Father{
	private String name;
	private Integer age;

}